# -*- coding: utf-8 -*-
#!/usr/bin/python

##copyright 2014 Sebastian Stetter
##This file is part of the Lemonade Small Business Suite project and released under GPL v2
##http://lemonade.sebastianstetter.de

from camelot.admin.validator.entity_validator import EntityValidator

class VoucherValidator(EntityValidator):

    def objectValidity(self, entity_instance):
        messages = super(VoucherValidator,self).objectValidity(entity_instance)
        if (not entity_instance.customer):
            messages.append("Customer needed")
            
        if (not entity_instance.voucher_type):
            messages.append("VoucherType needed")
            
        if (not entity_instance.currency):
            messages.append("Currency needed")
            
        if (not entity_instance.voucher_number) or (entity_instance.voucher_number == 0):
            messages.append("No voucher number")
            
        if (not entity_instance.customer_number) or (entity_instance.customer_number == 0):
            messages.append("No customer number, does customer have one?")
        
        return messages
    
